package com.centaline.androidsalesblog.api.sale;

import android.text.TextUtils;

import com.baidu.mapapi.model.LatLng;
import com.centaline.androidsalesblog.api.SaleApi;
import com.centaline.androidsalesblog.model.responseobject.EsfEstateListRo;
import com.centanet.framework.interfaces.IResponseListener;

/**
 * 小区列表-地图使用
 * Created by guilin on 16/5/10.
 */
public class EsfMapApi extends SaleApi<EsfEstateListRo> {

    private String postType;
    private String price = "0";
    private String area = "0";
    private String room = "0";
    private String minInputPrice = "";
    private String maxInputPrice = "";
    private LatLng northeast, southwest;

    public EsfMapApi(Class<?> tag, Class<EsfEstateListRo> aClass, IResponseListener<EsfEstateListRo> iResponseListener) {
        super(tag, aClass, iResponseListener);
    }

    public void setPostType(String postType) {
        this.postType = postType;
    }

    public void setPrice(String price) {
        if (TextUtils.isEmpty(price)) {
            this.price = "0";
        } else {
            this.price = price;
        }
    }

    public void setArea(String area) {
        if (TextUtils.isEmpty(area)) {
            this.area = "0";
        } else {
            this.area = area;
        }
    }

    public void setRoom(String room) {
        if (TextUtils.isEmpty(room)) {
            this.room = "0";
        } else {
            this.room = room;
        }
    }

    public void setMinInputPrice(String minInputPrice) {
        this.minInputPrice = minInputPrice;
    }

    public void setMaxInputPrice(String maxInputPrice) {
        this.maxInputPrice = maxInputPrice;
    }

    public void setNortheast(LatLng northeast) {
        this.northeast = northeast;
    }

    public void setSouthwest(LatLng southwest) {
        this.southwest = southwest;
    }

    @Override
    protected void setParams() {
        putStringParams("posttype", postType);
        putStringParams("price", price);
        putStringParams("area", area);
        putStringParams("room", room);
        putParams("minInputPrice", minInputPrice);
        putParams("maxInputPrice", maxInputPrice);
        putParams("lngMin", southwest.longitude);
        putParams("lngMax", northeast.longitude);
        putParams("latMin", southwest.latitude);
        putParams("latMax", northeast.latitude);
    }

    @Override
    protected String getPath() {
        return "EsfEstate";
    }
}
